home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / BOZOL2.ZIP / CALC.CMD < prev    next >
OS/2 REXX Batch file  |  1994-02-08  |  777b  |  19 lines

  1.         CASE "CALC","EVAL","WHAT"
  2.                 ' Build an expression to calculate by stringing together
  3.                 ' all pushed arguments that may constitute an arithmetic
  4.                 ' expression.  When we come to a non arithmetic symbol or
  5.                 ' bit of text, push it back and calculate what we have.
  6.                 A$=""
  7.                 DO
  8.                     B$=POPARG$
  9.                         IF VERIFY(B$,"01234567890 .+-/\*^()><=") THEN
  10.                             PUSHARG B$
  11.                                 EXIT LOOP
  12.                         END IF
  13.                 A$=A$+B$
  14.                 LOOP WHILE ArgPtr%>0
  15.                 PUSHARG STR$(CALC(A$))
  16.  
  17.     CASE "+","-","/","\","*","^","(",")",">","<","=","&"
  18.                 PUSHARG PRG$
  19.